<template>
    <el-submenu :index="item.url" :key="item.url">
        <template>
          <i :class="item.icon"></i>
          <span slot="title">{{ item.name }}</span>
        </template>
        <template v-for="subItem in item.childList">
          <el-submenu v-if="subItem.childList" :index="subItem.url" :key="subItem.url">
            <template slot="title">{{ subItem.name }}</template>
            <el-menu-item
              v-for="(threeItem,i) in subItem.childList"
              :key="i"
              :index="threeItem.url"
            >{{ threeItem.name }}</el-menu-item>
          </el-submenu>
          <router-link v-else :to="{path:subItem.url}">
              <el-menu-item  :index="subItem.url" :key="subItem.url">{{ subItem.name }}</el-menu-item>
          </router-link>
        </template>
    </el-submenu>
</template>

<script>

export default {
  name: 'SidebarItem',
  props: {
    // route object 父传子 父传过来的参数
    item: {
      type: Object,
      required: true
    },
  },
  data() {
    // To fix https://github.com/PanJiaChen/vue-admin-template/issues/237
    // TODO: refactor with render function
    return {
      
    }
  },
  created(){
     
  },
  methods: {
   
    
  }
}
</script>
